x

Base64 Shell Transfers

1. On your attacker machine:

Encode your payload:

base64 -w 0 yourfile.sh > yourfile.b64

(Use -w 0 to make it a single long line, which is easier to paste.)

2. On the target machine (in reverse shell):

Run:

cat > /tmp/yourfile.b64

Then paste the entire base64 string (you'll see no output), and when done:
Press Ctrl + D

This tells the shell: "EOF — input is finished"

Alternatively, paste the base64 string into nano/echo/vim. Note this working will depend on the shell behaviour and connection type.

echo 'string' > file.b64

3. On the target:

Decode it:

base64 -d /tmp/yourfile.b64 > /tmp/yourfile.sh chmod +x /tmp/yourfile.sh

Then run:

/tmp/yourfile.sh

Example: Transfer a test file

Let’s say you want to send a simple file with the content echo "Hello from attacker":

On attacker:

echo 'echo "Hello from attacker"' > hello.sh base64 -w 0 hello.sh > hello.b64

Copy the base64 blob.

On victim:

cat > /tmp/hello.b64
Then paste the blob, then hit Ctrl+D

Now decode:
base64 -d /tmp/hello.b64 > /tmp/hello.sh chmod +x /tmp/hello.sh /tmp/hello.sh

Left-click: follow link, Right-click: select node, Scroll: zoom
x